# This is an API workspace, having public visibility by default makes perfect sense.
package(default_visibility = ["//visibility:public"])

##############################################################################
# Common
##############################################################################
load("@com_google_api_codegen//rules_gapic:gapic.bzl", "proto_library_with_info")

proto_library(
    name = "iam_admin_proto",
    srcs = ["iam.proto"],
    deps = [
        "//google/api:annotations_proto",
        "//google/iam/v1:iam_policy_proto",
        "//google/iam/v1:policy_proto",
        "@com_google_protobuf//:empty_proto",
        "@com_google_protobuf//:field_mask_proto",
        "@com_google_protobuf//:timestamp_proto",
    ],
)

proto_library_with_info(
    name = "iam_admin_proto_with_info",
    deps = [":iam_admin_proto"],
)

##############################################################################
# Go
##############################################################################
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@com_google_api_codegen//rules_gapic/go:go_gapic.bzl", "go_gapic_srcjar", "go_gapic_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@com_google_api_codegen//rules_gapic/go:go_gapic_pkg.bzl", "go_gapic_assembly_pkg")

go_proto_library(
    name = "iam_admin_go_proto",
    compilers = ["@io_bazel_rules_go//proto:go_grpc"],
    importpath = "google.golang.org/genproto/googleapis/iam/admin/v1",
    protos = [":iam_admin_proto_with_info"],
    deps = [
        "//google/api:annotations_go_proto",
        "//google/iam/v1:iam_go_proto",
    ],
)

go_gapic_library(
    name = "iam_admin_go_gapic",
    src = ":iam_admin_proto_with_info",
    gapic_yaml = "iam_gapic.yaml",
    importpath = "cloud.google.com/go/iam/admin/apiv1",
    service_yaml = "//google/iam:iam.yaml",
    deps = [
        ":iam_admin_go_proto",
        "//google/iam/v1:iam_go_proto",
    ],
)

go_test(
    name = "iam_admin_go_gapic_test",
    srcs = [":iam_admin_go_gapic_srcjar_test"],
    embed = [":iam_admin_go_gapic"],
    importpath = "cloud.google.com/go/iam/admin/apiv1",
    deps = ["//google/iam/v1:iam_go_proto"],
)

# Opensource Packages
go_gapic_assembly_pkg(
    name = "gapi-cloud-iam-admin-v1-go",
    deps = [
        ":iam_admin_go_gapic",
        ":iam_admin_go_gapic_srcjar-smoke-test.srcjar",
        ":iam_admin_go_gapic_srcjar-test.srcjar",
        ":iam_admin_go_proto",
    ],
)
